<%@ page language="java" pageEncoding="UTF-8"%>
<%@taglib uri="/struts-tags" prefix="s"%>
<html>
  <head>
    <title>Bug Information</title>
	<link href="<s:url value="/css/admin.css"/>" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<s:url value="/js/prototype.js"/>"></script>
	<s:head theme="ajax"/>
  </head>
  <script type="text/javascript">
  	var isChanged=false;
  	var oldIndex=0;
  	function setChanged()
  	{
  		isChanged=true;
  	}
  	function showSubType(type)
  	{
  		if(!isChanged || confirm('Bug detail could be lost if you change the bug type.\n Are you continue?'))
  		{
	  		subtype.innerHTML='Loading...';
	  		var url='<s:url action="showsubtype"/>';
	  		var pars='type='+type.value;
	  		var myAjax = new Ajax.Updater('subtype', url, {method: 'get', parameters: pars});
	  		isChanged=false;
	  		oldIndex = type.value;
	  		return true;
  		}else
  		{
  			type.value=oldIndex;
  			return false;
  		}
  	}
  	window.attachEvent('onload',function (){showSubType(frm.elements['debug.type']);});
  </script>

 <body>
 <s:form action="savedebug" method="post" name="frm">
	<center>
	  <b>Bug Information</b>
	</center><br>
	<table width="50%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><s:actionerror/><s:fielderror/> </td>
  </tr>
</table>
	<table width="70%"  border="1" align="center" cellpadding="0" cellspacing="0"  style="border-collapse:collapse ">
  <tr>
    <td width="25%" height="25" align="right">Title:</td>
    <td width="75%">
    	<s:textfield name="debug.title"/>
    </td>
  </tr>
  <tr>
    <td height="25" align="right">Tester:</td>
    <td><s:select list="userList" listKey="userid"  listValue="name" headerKey="" headerValue="[select a user]" name="debug.user"/> </td>
  </tr>
  <tr>
    <td height="25" align="right">Testing Date:</td>
    <td><s:datetimepicker name="debug.auditDate" displayFormat="yyyy-MM-dd" /> </td>
  </tr>
  <tr>
    <td height="25" align="right">Bug Type:</td>
    <td><s:select list="@com.debug.config.Constant@DEBUG_TYPE_MAP" headerKey="-1" headerValue="[select a type]" name="debug.type" onchange="showSubType(this);"/> </td>
  </tr>
  <tr>
    <td height="25" align="right">System:</td>
    <td><s:select list="%{config.getSystem()}" headerKey="-1" headerValue="[select a system]" name="debug.system"/> </td>
  </tr>
    <tr align="center">
    <td height="25" colspan="2">Bug Detail </td>
    </tr>
  <tr>
    <td colspan="2" align="center"><div id="subtype"></div> </td>
    </tr>
</table>
<br>
<table width="15%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr align="center">
    <td width="53%"><input type="submit" value=" Submit "></td>
    <td width="47%"><input type="reset" value=" Reset "></td>
  </tr>
</table>
</s:form>
</body>
</html>
